package com.xbang.attendance.web.action.warehouse.stock;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.xbang.attendance.entity.stock.InventoryRecord;
import com.xbang.attendance.service.InventoryService;
import com.demo2do.lighturl.annotation.Action;
import com.xbang.core.page.Page;
import com.xbang.core.page.Result;
import com.xbang.core.struts.support.SearchActionSupport;

public class InventoryrecordDetailSearch extends SearchActionSupport {

	@Autowired
	private InventoryService inventoryService;

	private List<InventoryRecord> inventoryRecords = new ArrayList<InventoryRecord>();
	
	public String execute() throws Exception {
		indexModth();
		return super.execute();
	}
	
	@Action("/warehouse/stock-inventoryrecord-detail/list/${id}")
	public String index() throws Exception {

		indexModth();
		return super.execute();
	}

	/**
	 * 
	 */
	private void indexModth() {
		if (page == null) {
			page = new Page(10);
		}
		Result result = inventoryService.searchByPage("FROM InventoryRecord ", new HashMap<String, Object>(), page);
		inventoryRecords = result.getItems();
		page = result.getPage();
	}
	
	@Override
	public void resetCustomerSearchCriteria() {
		// TODO Auto-generated method stub
		
	}

	public InventoryService getInventoryService() {
		return inventoryService;
	}

	public void setInventoryService(InventoryService inventoryService) {
		this.inventoryService = inventoryService;
	}

	public List<InventoryRecord> getInventoryRecords() {
		return inventoryRecords;
	}

	public void setInventoryRecords(List<InventoryRecord> inventoryRecords) {
		this.inventoryRecords = inventoryRecords;
	}

	
}
